/*=============================================================================
*
*   Copyright (C) 2020 All rights reserved.
*
*   Filename:		elastic.hpp
*
*   Author: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Date: 2020-02-19 23:52
*
*   Last Editors: Wang Zhecheng - wangzhecheng@yeah.net
*
*   Last modified:	2020-07-20 16:20
*
*   Description:
*
=============================================================================*/
#ifndef ELASTIC_H
#define ELASTIC_H

#include "material_interface.hpp"

namespace geoxfem {
namespace material {

template <typename DimensionType>
struct Elastic : MaterialInterface<DimensionType> {
  DEFINE_KEY(Elastic)

  using Record = util::iRecord<DimensionType>;
  using ptree  = boost::property_tree::ptree;
  using Stress = geoxfem::arithmetic::Stress<DimensionType>;
  using Strain = geoxfem::arithmetic::Strain<DimensionType>;

  Elastic(const ptree& param) : MaterialInterface<DimensionType>{param} {}

  MatrixXR getDeeMatrix(const Stress&, const Record&) const final override {
    return this->getElasticDeeMatrix();
  }

protected:
  /** update stress history related parameters for given sigma and epsilon
   * (only override in hardening/softening material for changing yield
   * function)
   *
   * @param s                 :
   * @param dpe
   * @param param        :
   */
  void updateStateParemeter(const Stress&,
                            const Strain&,
                            Record&) const final override {}
  //________________________________________________________________

  /** get the value of the yield function
   *
   * @param s                :
   * @param param
   * @return
   */
  _real getYieldFunction(const Stress& s,
                         const Record& param) const final override {
    return -1;
  }
};

}  // namespace material
}  // namespace geoxfem
#endif /* ELASTIC_H */
